package cn.seecoder.ai.dao;

import cn.seecoder.ai.model.po.FileField;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface FileFieldRepository extends JpaRepository<FileField, Integer>, JpaSpecificationExecutor<FileField> {


    @Transactional
    @Modifying  // No EntityManager with actual transaction available for current thread - cannot reliably process 'remove' call
    void deleteByFileInfoId(Integer fileInfoId);

    List<FileField> findByFileInfoId(Integer fileInfoId);

    List<FileField> findByFileInfoIdAndFieldName(Integer fileInfoId,String fieldName);
}